Working With Alternate Tracks
The Movie Toolbox allows you to define alternate tracks in a movie. You can use alternate tracks to support multiple languages or to present different levels of visual quality in the movie. You collect alternate tracks into groups. Alternate track groups are collections of tracks that conceptually represent some data but are appropriate for use in different play environments. For example, you might have some 4-bit data in one track and some 8-bit data in another. Working with alternate tracks allows you to set up alternatives from which the Movie Toolbox can choose.The Movie Toolbox selects one track from each alternate group when it plays the movie. For example, you could create a movie that has three separate audio tracks: one in English, one in French, and one in Spanish. You would collect these audio tracks into an alternate group. When the user plays the movie, the Movie Toolbox selects the track from this group that corresponds to the current language setting for the movie.
Similarly, you can use alternate tracks to store data of different quality. When the user plays the movie, the Movie Toolbox selects the track that best suits the capabilities of the Macintosh computer on which the movie is being played. In this manner, you can create a single movie that can accommodate the playback characteristics of a number of different computer configurations.
The Movie Toolbox allows you to store quality information for media structures that are assigned to either sound or video tracks. For all tracks, the Movie Toolbox uses bits 6 and 7 of the quality setting. These bits encode a relative quality value. These values range from 0 to 3. You can use higher quality values to indicate larger sample sizes. For example, consider a movie that has two sound tracks that are alternates for each other--one contains 8-bit sound while the other contains 16-bit sound. You could assign a quality value of
mediaQualityNormal
to the 8-bit media and a value ofmediaQualityBetter
to the 16-bit media. The Movie Toolbox would only play the 16-bit media if the Macintosh configuration could handle 16-bit sound. Otherwise, the Movie Toolbox would use the 8-bit media. The sound media handler determines the sample size for each sound media for the Movie Toolbox by examining the media's sound description structure.In addition, the Movie Toolbox also uses bits 0 through 5 (the low-order bits) of the quality setting. You use these bits to indicate the pixel depths at which the media should be played. Each bit corresponds to a single depth value, ranging from 1-bit pixels to 32-bit pixels. You may use these bits to control the playback of both video and
sound tracks.As an example, consider a movie that contains three video tracks with the following characteristics:
Track A 1-bit video data, no compression Track B Compressed using the Apple Video Compressor Track C Compressed using the Joint Photographic Experts Group (JPEG) compressor You could assign the following quality values to these track's media structures:
The Movie Toolbox would always use Track A when playing the movie on 1-bit and 2-bit displays. At the other pixel depths, the video media handler determines which track to use by examining the availability and performance of the specified decompressors. If the JPEG decompressor can play back at full frame rate, the Movie Toolbox would use Track C. Otherwise, the Toolbox uses Track B. The video media handler determines the compressor that is appropriate for each media by examining the media's image description structure.
You set a movie's language by calling the
SetMovieLanguage
function.To establish alternate groups of tracks, you can use the
SetTrackAlternate
andGetTrackAlternate
functions.You can work with the language and quality characteristics of media by calling the
GetMediaLanguage
,SetMediaLanguage
,GetMediaQuality
, andSetMediaQuality
functions.By default, the Movie Toolbox automatically selects the appropriate tracks to play according to a movie's quality and language settings, as well as the capabilities of the Macintosh computer. Whenever your application calls the
SetMovieGWorld
,SetMovieBox
,UpdateMovie
, orSetMovieMatrix
function (described on page 2-145, page 2-146, page 2-112, and page 2-155, respectively), the Movie Toolbox checks each alternate group for an appropriate track. However, you can control this selection process. Use theSetAutoTrackAlternatesEnabled
function to enable or disable automatic track selection. TheSelectMovieAlternates
function instructs the Movie Toolbox to select appropriate tracks immediately. If no tracks in an alternate track group are enabled, then the Movie Toolbox does not activate any track from that group during automatic track selection.
Subtopics
- SetMovieLanguage
- SelectMovieAlternates
- SetAutoTrackAlternatesEnabled
- SetTrackAlternate
- GetTrackAlternate
- SetMediaLanguage
- GetMediaLanguage
- SetMediaQuality
- GetMediaQuality